const {
  defineConfig
} = require('@vue/cli-service')
// const CopyWebpackPlugin = require('copy-webpack-plugin')
const path = require("path");
const webpack = require('webpack')
module.exports = defineConfig({
  chainWebpack: config => {
    config.module
      .rule('vue')
      .test(/\.vue$/)
      .use('style-vw-loader')
      .loader('style-vw-loader')
      .options({
        viewportWidth: 1920,
      })
  },
  publicPath: './',
  outputDir: "dist", // 输出文件目录
  lintOnSave: false, // eslint 是否在保存时检查
  assetsDir: 'static', // 配置js、css静态资源二级目录的位置  
  lintOnSave: false, //关闭eslint检查
  devServer: {
    host: "0.0.0.0", //默认是 localhost。如果你希望服务器外部可访问，指定如下 host: '0.0.0.0'，设置之后之后可以访问ip地址
    port: 8085,
    proxy: {
      // http://dxtz666.cn https://dxstzb.nccloudmedia.com
      "/api": {
        target: "https://ncxrd.jxscloudmedia.com/index.php",

        changeOrigin: true,

        secure: false, //false为http访问，true为https访问

        pathRewrite: {
          "^/api": ""
        }
      }
    }
  },
  transpileDependencies: [
    'vuetify'
  ],
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "less",
      patterns: [
        // 存放less变量文件的路径
        path.resolve(__dirname, "./src/assets/less/parameter.less")
      ]
    }
  },
  css: {
    loaderOptions: {
      less: {
        lessOptions: {
          modifyVars: {
            'primary-color': '#ec6800'
          },
          javascriptEnabled: true,
        },
      },
    },
  },
  productionSourceMap: false,//隐藏源码
  // // easy-player  相关
  // configureWebpack: {
  //   plugins: [
  //     new CopyWebpackPlugin([
  //       {
  //         from: 'node_modules/@easydarwin/easyplayer/dist/component/EasyPlayer.swf',
  //         to: './libs/EasyPlayer/'
  //       },
  //       {
  //         from: 'node_modules/@easydarwin/easyplayer/dist/component/crossdomain.xml',
  //         to: './libs/EasyPlayer/'
  //       },
  //       {
  //         from: 'node_modules/@easydarwin/easyplayer/dist/component/EasyPlayer-lib.min.js',
  //         to: './libs/EasyPlayer/'
  //       }
  //     ])
  //   ]
  // },
  // transpileDependencies: true,
  // lintOnSave: false,
  // productionSourceMap: false
})